/**
 * Created by jianglinjie on Wed Oct 11 2017
 */
'use strict';

import { ConfigService } from '../../src';
import { ServiceNetHandler } from '../../src';
import { FetchClient } from '../../src';
import Storage from 'react-native-storage';


class TestStorage {
  store = {};
  
  getItem(key) {
    return this.store[key] || null;
  }

  setItem(key, value) {
    this.store[key] = value + '';
  }

  removeItem(key) {
    this.store[key] = null;
  }

  clear() {
    this.store = {};
  }
}

//注入处理器
FetchClient.addHandler(ServiceNetHandler);
ConfigService.apiBaseHost = 'http://localhost:3001/api/v1';
ConfigService.storage = new Storage({
  storageBackend: new TestStorage(),
  defaultExpires: 1000 * 3600 * 24 * 7,
});